package com.bms.hystrix.interfaces.gllw;

import com.bms.hystrix.pojo.LunWen;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.Map;

// 此接口与feign中定义的接口一样，直接迁移过来即可
// 调用一个子服务模块，需要在注解中指定，名字由client的yml文件定义
@FeignClient(value = "EUREKA-CLIENT-GLLWZZ")

public interface ServiceFeignByCheck {
    /*
    这里需要几个要点：
    1.这里定义的路径作用是调用client中的接口
    2.这里的method即是只定义了get，在feign还是会检查client是否允许post请求，如果没有post请求将报错
    3.@RequestParam(value = "name")是绑定controller中的形式参数名，如果没有value属性定义也会报错
     */
//    @RequestMapping(value = "/check",method = RequestMethod.GET,
//            produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    Map selectClient(@RequestParam(value = "name") String name);


    @RequestMapping(value = "/guanLiLunWen/lianHeChaXun",method = RequestMethod.GET,
            produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Map<String, Object> lianHeChaXun(@RequestParam(value = "tiMu") String tiMu,
                                     @RequestParam(value = "zuoZhe") String zuoZhe,
                                     @RequestParam(value = "faBiaoWeiZhi") String faBiaoWeiZhi,
                                     @RequestParam(value = "lunWenLeiBie") String lunWenLeiBie,
                                     @RequestParam(value = "faBiaoShiJianQiShi") Date faBiaoShiJianQiShi,
                                     @RequestParam(value = "faBiaoShiJianJieShu") Date faburen
    );


    @RequestMapping(value = "/guanLiLunWen/chaXunAll",method = RequestMethod.GET,
            produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Map<String, Object> chaXunAll();


    @RequestMapping(value = "/guanLiLunWen/chaXunById",method = RequestMethod.GET,
            produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Map<String, Object> chaXunById(
            @RequestParam(value = "id") int id
    );


    @RequestMapping(value = "/guanLiLunWen/chaXunByLeiBie",method = RequestMethod.GET,
            produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Map<String, Object> chaXunByLeiBie(
            @RequestParam(value = "lunWenLeiBie") String lunWenLeiBie
    );




    @RequestMapping(value = "/guanLiLunWen/chaXunCaoGao",method = RequestMethod.GET,
            produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Map<String, Object> chaXunCaoGao(
            @RequestParam(value = "index") int index
    );



    @RequestMapping(value = "/guanLiLunWen/chaXunFenYe",method = RequestMethod.GET,
            produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Map<String, Object> chaXunFenYe(
            @RequestParam(value = "page") int page
    );



    @RequestMapping(value = "/guanLiLunWen/chaXunFenYe01",method = RequestMethod.GET,
            produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Map<String, Object> chaXunFenYe01(
            @RequestParam(value = "page") int page,
            @RequestParam(value = "tiMu") String tiMu,
            @RequestParam(value = "zuoZhe") String zuoZhe,
            @RequestParam(value = "faBiaoWeiZhi") String faBiaoWeiZhi,
            @RequestParam(value = "lunWenLeiBie") String lunWenLeiBie,
            @RequestParam(value = "faBiaoShiJianQiShi") String faBiaoShiJianQiShi,
            @RequestParam(value = "faBiaoShiJianJieShu") String faBiaoShiJianJieShu
    );




    @RequestMapping(value = "/guanLiLunWen/chaXunCount",method = RequestMethod.GET,
            produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Map<String, Object> chaXunCount(
            @RequestParam(value = "index") int index
    );



    @RequestMapping(value = "/guanLiLunWen/chaXunCount01",method = RequestMethod.GET,
            produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Map<String, Object> chaXunCount01(
            @RequestParam(value = "index") int index,
            @RequestParam(value = "tiMu") String tiMu,
            @RequestParam(value = "zuoZhe") String zuoZhe,
            @RequestParam(value = "faBiaoWeiZhi") String faBiaoWeiZhi,
            @RequestParam(value = "lunWenLeiBie") String lunWenLeiBie,
            @RequestParam(value = "faBiaoShiJianQiShi") String faBiaoShiJianQiShi,
            @RequestParam(value = "faBiaoShiJianJieShu") String faBiaoShiJianJieShu
    );




    @RequestMapping(value = "/guanLiLunWen/gengXinById",method = RequestMethod.POST,
            produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Map<String, Object> gengXinById(@RequestParam(value = "lunWen") LunWen lunWen,
                                    @RequestParam(value = "request") HttpServletRequest request,
                                    @RequestParam(value = "lunWen") MultipartFile file);



    @RequestMapping(value = "/guanLiLunWen/xiaZai",method = RequestMethod.POST,
            produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Map<String, Object> xiaZai(@RequestParam(value = "request") HttpServletRequest request,
                               @RequestParam(value = "response") HttpServletResponse response,
                               @RequestParam(value = "diZhi") String diZhi);
//    HttpServletRequest request, HttpServletResponse response, String diZhi


    @RequestMapping(value = "/guanLiLunWen/xinZeng",method = RequestMethod.POST,
            produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Map<String, Object> xinZeng(@RequestParam(value = "lunWen") LunWen lunWen,
                                @RequestParam(value = "request") HttpServletRequest request,
                                @RequestParam(value = "file") MultipartFile file);



    @RequestMapping(value = "/guanLiLunWen/shanChuById",method = RequestMethod.GET,
            produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Map<String, Object> shanChuById(@RequestParam(value = "id") String id);



}
